package day1208_3;

public class T2 {
    public static void main(String[] args) {
        Cat  hmjz=new Cat();
        System.out.println(hmjz.color);
        hmjz.setWeight();//调用setWeight()方法给weight变量赋值一个5
        hmjz.color="黑";//给hmjz对象的color属性赋值为"黑"
        System.out.println(hmjz.color);
        System.out.println(hmjz.name);//获取hmjz的name
        hmjz.hunting();//使用黑猫警长的hunting()方法
    }
}

class Cat{//猫相关的代码写道括号里边
    String color;
    private double weight;
    public String name;
    void setWeight(){
        weight=5;
    }
    void hunting(){
        System.out.println("抓老鼠");
    }
}




